package cn.edu.zzu.demo01Thread;

/**
 * 线程实现方式
 */
public class ThreadDemo01 extends Thread {
    public static void main(String[] args) {
        new ThreadDemo01().start();
        for (int i = 0; i < 20; i++) {
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"==>"+" Main操作了  "+i);
        }
    }

    @Override
    public void run() {
        for (int i = 0; i < 20; i++) {
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"==>"+" Thread操作了  "+i);
        }
    }
}
